VERSION 5.00
Begin VB.Form FrmLauncher 
   AutoRedraw      =   -1  'True
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   1  'Fixed Single
   Caption         =   "Pac Mar Launcher"
   ClientHeight    =   2760
   ClientLeft      =   90
   ClientTop       =   1695
   ClientWidth     =   4800
   Icon            =   "FrmLauncher.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   184
   ScaleMode       =   3  'Pixel
   ScaleWidth      =   320
   StartUpPosition =   2  'CenterScreen
   Begin VB.Image imgEditor 
      Appearance      =   0  'Flat
      Height          =   1455
      Left            =   3480
      Top             =   600
      Width           =   975
   End
   Begin VB.Image imgFullscreen 
      Appearance      =   0  'Flat
      Height          =   1455
      Left            =   1800
      Top             =   600
      Width           =   1335
   End
   Begin VB.Image imgPlay 
      Appearance      =   0  'Flat
      Height          =   1215
      Left            =   480
      Top             =   600
      Width           =   1095
   End
End
Attribute VB_Name = "FrmLauncher"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

'APIs -------------------------------------------------------------------------------
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private WithEvents Timer As vbalHiResTimer6.cHiResTimer
Attribute Timer.VB_VarHelpID = -1
Private Background As New clsScrollingBG
Private Buffer As New ImageDC
Private Play As New ImageTGA
Private Fullscreen As New ImageTGA
Private Editor As New ImageTGA

Dim hSmallFont As Long

Private Sub Form_Load()
    SharedIconRes.SetIcon FrmLauncher.hWnd, "MAINICON"
    Background.Initialize "Candy", -2, 1
    Play.LoadTGA32 AppPath & "\gfx\Sprites\PacMar_r.tga", True
    Fullscreen.LoadTGA32 AppPath & "\gfx\Sprites\Zim.tga", True
    Editor.LoadTGA32 AppPath & "\gfx\Editor\Level Editor.tga"
    
    Buffer.Create Me.ScaleWidth, Me.ScaleHeight
    
    Set Timer = New vbalHiResTimer6.cHiResTimer
    Timer.Add "Animation", AnimTimer, True
    
    Me.Caption = MainSubs.AppTitle
    FrmLauncher.Show
End Sub

Public Function Render()
    Background.Animate
    Background.Render Buffer.hDC
    
    If (Frame.Count Mod 3) = 0 Then Play.Animate: Fullscreen.Animate
    Play.Draw Buffer.hDC, 30, 32
    Fullscreen.Draw Buffer.hDC, 130, 32
    Editor.Draw Buffer.hDC, 240, 40
    
    FontPastel.DrawText Buffer.hDC, 40, 95, "Play", 1
    FontPastel.DrawText Buffer.hDC, 135, 95, "Play", 1
    FontPastel.DrawText Buffer.hDC, 105, 115, "Fullscreen", 1
    FontPastel.DrawText Buffer.hDC, 240, 95, "Level", 1
    FontPastel.DrawText Buffer.hDC, 235, 115, "Editor", 1
    
    Buffer.Draw Me.hDC, 0, 0
    Me.Refresh
End Function

Private Sub Form_Unload(Cancel As Integer)
    Set Background = Nothing
    Set Buffer = Nothing
    Set Play = Nothing
    Set Fullscreen = Nothing
    Set Editor = Nothing
    MainSubs.EndProgram
End Sub

Private Sub imgEditor_Click()
    ShellExecute Me.hDC, "open", AppPath & "\Level Editor.exe", "", "", 1
    Unload Me
End Sub

Private Sub imgFullscreen_Click()
    ShellExecute Me.hDC, "open", AppPath & "\Pac Mar.exe", "-fullscreen", "", 1
    Unload Me
End Sub

Private Sub imgPlay_Click()
    ShellExecute Me.hDC, "open", AppPath & "\Pac Mar.exe", "", "", 1
    Unload Me
End Sub

Private Sub Timer_Timer(ByVal sKey As String)
    Render
    Frame.Count = Frame.Count + 1
End Sub
